<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>请登录</title>
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>

    <style>
        body {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
    </style>
</head>
<body>

    <div id="tip">
        <h1>请先登录</h1>
        <h4 id="timer"></h4>
    </div>


    <script>
        $(document).ready(function () {
            let time = 3;

            let timer = setInterval(function () {
                if (time == 0) {
                    time = 3
                    clearInterval(timer)
                    $(location).attr("href", "/")
                } else {
                    console.log(time)
                    time --
                    $('#timer').text(time + " 秒后自动跳转...")
                }
            }, 1000)
        })
    </script>

</body>
</html>